package com.atguigu.springCloud.controller;

import com.atguigu.springCloud.service.PaymentFeignService;
import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Slf4j
public class PaymentFeignController {


    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/payment/get/{id}")
    public CommonResult getPaymentById(@PathVariable("id") long id){
        log.info("feign controller");
        return paymentFeignService.getPaymentById(id);
    }


    @PostMapping(value = "/consumer/payment/create")
    public CommonResult create(Payment payment){
        log.info("feign controller create");
       return paymentFeignService.create(payment);
    }

    @GetMapping("/consumer/payment/timeout")
    public String timeout(){
        return paymentFeignService.timeout();
    }
}
